import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsOptional, IsString } from 'class-validator'
import { ApiProperty } from '@nestjs/swagger'
import { CClassStatus } from '../constant'

export class QueryClassDto {
  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  page?: number = 1

  @ApiProperty({ description: '每页数量', required: false, default: 10 })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  pageSize?: number = 10

  @ApiProperty({ description: '班级ID', required: false })
  @IsOptional()
  @IsString()
  classId?: string

  @ApiProperty({ description: '班级名称', required: false })
  @IsOptional()
  @IsString()
  className?: string

  @ApiProperty({ description: '班级学级', required: false })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  classGrade?: number

  @ApiProperty({ description: '班级状态', required: false, enum: CClassStatus })
  @IsOptional()
  @IsEnum(CClassStatus)
  @Type(() => Number)
  status?: CClassStatus
}